"""ImageThinking URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
import xadmin
from django.views.generic import TemplateView
from django.conf.urls import url
from users.views import register, user_page, user_info
from users.views import send_message
from rest_framework_jwt.views import obtain_jwt_token
from users.views import ObtainJSONWebToken, is_exist_mobile
from image_query.views import upload_image, upload_test
from adlist.views import getData, index, index_details, searchAd, index2, agreement_page, privacy, index_test, \
    test_detail
from collection_manage.views import collect, collection, user_collection, is_collect
from ad_manage.views import advertisement_details, advertisement_date, advertisement_industry, \
    advertisement_random_data, \
    get_all_appname, purchase_page, product_introduction, get_all_size,check_vip
from adlist.tasks import  testdownload, \
     toutiao_new_task, souhu_new_task, sina_new_task, random_tasks, test_souhu, fenghuang_new_task
from adlist.test import feedsradar_task, toutiao_task,fenghuang_task,souhu_task,radar_task,sina_task
from adlist.test import testsouhu, update_all_localimg
from ad_manage.tests import un_watermark, test_tag
from ad_manage.views import image_like, host_like, konwledge_page
from image_query.tasks import save_feature_test, save_tag_test,save_feature_npy

from it_alipay.views import pay_page, pay_finish_page, pay_index, set_meal_test, order_record, pay_order_page
from image_query.views import select_same_image,select_same_image_test
from django.views.static import serve
from .settings import MEDIA_ROOT
from ad_school.views import showAdSchool, getAdSchoolInfo, showAllLabel, getNewArticle, showArticle, handleZan, \
    showArticleByTab
from django.conf.urls import url, include

urlpatterns = [
    path('admin/', xadmin.site.urls),
    url('^$', index),
    url('^error', TemplateView.as_view(template_name="html/main/error.html"), name="error"),
    url('register/$', register),
    url('^user/send_message', send_message),
    url('mobile_login/', ObtainJSONWebToken.as_view()),
    path('login/', obtain_jwt_token),
    # 跳转详情页
    path('index/', index),
    # 跳转详情页
    path('index_details/', index_details),
    # 首页广告数据列表展示
    path('getData/', getData),
    path('upload_image/', upload_image),
    path('upload_test/', upload_test),
    # 点击收藏和取消收藏
    path('collect/', collect),
    # 详情页-查询当前广告数据
    path('ad_details/', advertisement_details),
    # 跳转收藏页
    path('collection/', collection),
    # 获取用户收藏列表
    path('user_collection/', user_collection),
    # 跳转用户信息页面
    path('user_page/', user_page),
    # 个人信息页面-获取用户信息
    path('user_info/', user_info),
    # 判断是否注册过的手机
    url('is_exist_mobile/$', is_exist_mobile),

    # 注册页面同意协议页面跳转
    path('agreement_page/', agreement_page),
    # 注册页面隐私政策页面跳转
    path('privacy/', privacy),
    # 测试代码
    path('testsouhu/', testsouhu),
    # 首页-按日期搜索
    path('advertisement_date/', advertisement_date),
    # 首页-按行业搜索
    path('advertisement_industry/', advertisement_industry),
    # 获取随机数据
    path('advertisement_random_data/', advertisement_random_data),
    # 定时任务生成随机数据
    path('random_tasks/', random_tasks),
    # 判断是否收藏过
    path('is_collect/', is_collect),

    # 获取所有平台
    path('get_all_appname/', get_all_appname),

    # 会员充值相关接口
    path('purchase_page/', purchase_page),
    path('pay_page/', pay_page),
    path('pay_finish_page/', pay_finish_page),

    # 删除各个app的广告备份，重新备份一次
    path('souhu_task/', souhu_task),
    path('sina_task/', sina_task),
    path('fenghuang_task/', fenghuang_task),
    path('toutiao_task/', toutiao_task),

    # 产品介绍 #
    path('product_introduction/', product_introduction),

    path('souhu_test/', test_souhu),

    path('test_image/', un_watermark),

    path('test_detail/', test_detail),
    # path('sina_new_task/',sina_new_task),
    path('test_tag/', test_tag),

    path('image_like/', image_like),
    path('get_all_size/', get_all_size),

    path('host_like/', host_like),
    # 提取特征码和提取标签
    path('save_feature_test/', save_feature_test),
    path('save_tag_test/', save_tag_test),

    path('update_all_localimg/', update_all_localimg),

    path('test_index/', index_test),

    path('konwledge/', konwledge_page),
    path('testfeature/', select_same_image_test),

    # 富文本编辑器
    url(r'^ueditor/', include('DjangoUeditor.urls')),
    # 处理图片显示的url,使用Django自带serve,传入参数告诉它去哪个路径找，我们有配置好的路径MEDIAROOT
    url(r'^imagethinking_school/(?P<path>.*)$', serve, {"document_root": MEDIA_ROOT}),
    path(r'show_ad_school', showAdSchool),
    path(r'showAllLabel', showAllLabel),
    path(r'getNewArticle', getNewArticle),
    path(r'get_ad_school', getAdSchoolInfo),
    url(r'^showArticle/(?P<pk>[0-9]+)/$', showArticle),
    url(r'^handleZan/(?P<pk>[0-9]+)/$', handleZan),
    url(r'^showArticleByTab/(?P<pk>[0-9]+)/$', showArticleByTab),

    # 套餐测试页面
    path(r'set_meal_test', set_meal_test),
    path('order_record/', order_record),
    path('pay_order_page/', pay_order_page),

    #查询用户等级
    path('check_vip/',check_vip),
    #信息流雷达备份测试
    path('feedsradar_task/',feedsradar_task),
    path('save_feature_npy/',save_feature_npy),

]
